1. Field of the Invention
The present invention relates to a method and system for processing an instruction set, specifically a method and system which is configured to compress the operation part in an instruction set, and to perform the corresponding decompression, wherein upon the compression an instruction sequence in the instruction set is divided into a operation part and a register part, and the operation codes most repeatedly emerging in two successive instructions are compressed, and furthermore, a pre-fetch mechanism can be used to promote the performance upon the decompression.
2. Description of the Prior Art
Due to limited memory in an embedded system the size of an application program code has to be reduced as far as possible. Especially for portable products, the reduction of the memory size leads to the reduction of cost, power consumption, volume and weight. The necessary memory size usually depends on the code size and the data size. It has become very important, therefore, to find a way for reducing the code size to lower the demand on the memory size.
In order to reduce the code size, new hardware frames have been proposed in several familiar techniques. ARM Technologies Inc. and MIPS Technologies Inc. have proposed ARM Thumb instruction set and MIPS16 respectively as a shorter instruction set for reducing the code size. However, because an original long instruction could have to be represented with many shorter instructions, the performance during the code execution is significantly reduced. On the other hand, International Business Machines (IBM) Corps. has taken Huffman encoding for their compression, partitioning a code word into two parts and applying Huffman encoding to these two parts separately. Its drawback is that Huffman encoding results in variable lengths of the code word so that this method pays a lot of penalty in decompression and performance.
In other techniques, code compression has been achieved in terms of software. Based on an 80-20 rule taken in a profile-guided code compression, a substantial performance loss can be avoided by compressing the instructions that are executed infrequently. But the compression ratio is reduced as compared with the hardware techniques as described above. Furthermore, in some further techniques this issue has been addressed by using a dictionary table, assigning each of the frequently occurring instructions to an index in the dictionary table. Then the index can be used to look up the dictionary table to fetch the correct instruction. The benefit of the techniques based on a dictionary is ease in decompression, but the corresponding compression ratio is only from 13% to 18%. This issue has been addressed by applying a hybrid technique, compressing a code according to different program characteristics to achieve a very high compression ratio. But the shortcoming of the hybrid technique is that the decompression and the execution can not be carried out at the same time, having to complete the compression before starting the execution.
Drawbacks of the known compression techniques described above are summarized as fallows:
1. The compression ratio and the performance can not be given consideration at the same time. A high compression ratio is accompanied by a loss in the performance, and the achievement of a high performance results at the same time in a low compression ratio.
2. Some techniques can only be applied to specific platforms, which limits their applicability.
3. In the techniques of high compression ratio the decompression and execution can not be carried out simultaneously, resulting in substantial performance loss.